Repository navigation
github-ci mirror: GitHub-side history in the projector (#14170 Q7) - #14299
Merged
Merged
Conversation
- github_issue_history table (mirror.sql + MIRROR_DDL): body_edited (hashes only), comment_added / comment_removed / comment_count_changed (counts only), parent_changed — diffed from a pre-upsert read under the upserts' own acceptance rules (tombstone + version guards), written fail-open in their own batch after the mirror batch lands. - parent_number projection on github_mirror_issues, from parent_issue_url in snapshot objects (parent_known CASE keeps the stored value when an object does not state a parent) and from sub_issues webhook deliveries (new route in index.ts). - Backfill sweep: parent joins the diff key; the sweep writes its own diff rows (actor=backfill), including forced count repairs, flushed fail-open. - Oracle tests: a body edit, a comment, and a re-parenting each produce exactly one correct row; a killed history write still lands the mirror upsert. Part of #14170 (Q7 of the queue-schema design); queue task 21705.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 6 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements Q7 of the queue-schema design (#14170; design of record
doc/2026-11-24T07-23-14Z_design_queue-metadata-history/, §8 + §11): GitHub-side history in the mirror projector (pkgs/github-ci/worker). Q7 depends on nothing in the Q-chain and lands independently of Q1.What
github_issue_history(mirror.sql +MIRROR_DDL, ensured idempotently like every mirror table): one append-only row per observed change —body_edited(hashes only, never bodies),comment_added/comment_removed/comment_count_changed(counts only; the direction kinds only when the delivery itself is anissue_commentaction; an agent-note pointer change rides the same row's detail),parent_changed. Diffs are computed from a pre-upsert read under the upserts' own acceptance rules — the tombstone guard and the snapshot/count version guards, spelled in TS beside their SQL twins (thedeletionBlockspattern) — so history never records a change that did not land, and first sights write nothing. Capture is fail-open (design §10.3): history rows are written in their own batch after the mirror batch lands, inside a catch.parent_numberprojection ongithub_mirror_issues(additive column,ensureMirrorColumnsmigration likecomments_gh_updated_at): parsed fromparent_issue_urlin snapshot objects — aparent_knownCASE in the upsert keeps the stored value when an object does not state a parent, and a cross-repo parent's repo rides theparent_changeddetail — and fromsub_issueswebhook deliveries (new route inindex.ts; unseen children are seeded minimal, as the comment path seeds).backfill) for the body/count/parent changes it lands, including forced count repairs — flushed fail-open and counted in the run summary (history_rows/history_failed).Reserved vocabulary, deliberately not written by this slice (per §11 scope):
linked/unlinked/state_changed. Emoji reactions remain the design's considered rejection (§8.3). No new dependencies.Oracle (§11 Q7) — as named tests
Editing a watched issue's body, commenting, and re-parenting a sub-issue each produce exactly one correct row; a killed history write still lands the mirror upsert. All four are tests in
test/mirror.test.ts("mirror history (#14170 Q7)"), plus redelivery, stale-snapshot, first-sight, and silent-parent cases.Evidence
Remote run (fleet queue dispatch; the executor image has no node/npm, so Node came from
nix shell nixpkgs#nodejs_22): run 45372159946 —npm ci(140 packages),tsc --noEmitclean, vitest: 7 files, 91 tests, all passed — mirror.test.ts 34 (15 new Q7 tests), worker.test.ts 20 (incl. the new sub_issues route test), backfill.test.ts 10 (incl. the new parent-bind test).Side finding, filed + enqueued separately: plain
npm cicurrently fails on a pre-existing peer conflict (wrangler 4.167 wants@cloudflare/workers-types^5; the package pins ^4) — #14298, queue task 23064. The verification run used--legacy-peer-depsfor that reason only.Ops note
The
sub_issuesroute receives deliveries only if the webhook subscription includes thesub_issuesevent — worth confirming in the webhook/App settings at deploy time. The snapshot + sweep parent projection works regardless.Part of #14170. Queue task 21705.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.